package com.debby.test.fish;

import java.io.File;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class ConfirmUpdateActivity extends Activity{
	

	private TextView confirminfo;
	private Button confirmyes;
	private Button confirmno;
	EditText et_cardId;
	String cardId;
	String downloadurl;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.confirm_orderno);
		confirminfo = (TextView) findViewById(R.id.confirminfo);
		confirmyes = (Button) findViewById(R.id.confirmyes);
		confirmno = (Button) findViewById(R.id.confirmno);
		confirminfo.setText(getIntent().getStringExtra("info"));
		Intent in = getIntent();
    	downloadurl = in.getStringExtra("downloadurl");
    	String upgradeType = in.getStringExtra("upgradeType");
    	if("1".equals(upgradeType)){
    		confirmno.setEnabled(false);
    	}
		
	}
	public void confirm(View v){
		File filetemp = new File(VersionUpdateService.filename);
		Intent intent = new Intent(Intent.ACTION_VIEW); 
		intent.setDataAndType(Uri.fromFile(filetemp), "application/vnd.android.package-archive"); 
		startActivity(intent);
		filetemp.deleteOnExit();
        stopService(new Intent(getApplicationContext(),VersionUpdateService.class));
		finish();
	}
	public void confirmno(View v){
		//关闭版本更新service
        stopService(new Intent(getApplicationContext(),VersionUpdateService.class));
		finish();
	}

}
